class Solution {
public:
    vector<bool> isArraySpecial(vector<int>& nums, vector<vector<int>>& queries)
    {
        vector<int> cmp(nums.size());
        for (int i = 1; i < nums.size(); i++)
            cmp[i] = (nums[i - 1] % 2 == nums[i] % 2) + cmp[i - 1];
        vector<bool> ans;
        for (int i = 0; i < queries.size(); i++)
            ans.push_back(cmp[queries[i][0]] == cmp[queries[i][1]]);
        return ans;
    }
};